import { getTokenInfo } from '@/utils/storage'
import { applyMiddleware, createStore } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunk from 'redux-thunk'
import rootReducer from './reducers'

// 创建store实例
const store = createStore(
  // 根reducer
  rootReducer,

  // 初始化加载的状态
  {
    login: getTokenInfo(),
  },

  // 中间键加强器  配置开发者redux工具
  composeWithDevTools(applyMiddleware(thunk))
)

export default store
